package com.ftg.learn.chapter02.entity;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;

import javax.annotation.PostConstruct;
import javax.annotation.PreDestroy;

/**
 * 指定名称  ： Component("uuuu") 注解容器成为组件时，把当前组件id起名为 "uuuu"
 * @author kangjx
 * @createTime 2022/11/2
 */
@Component(value = "user")
@Scope(value = "prototype")
public class User {

    @PreDestroy
    public void abc1(){
        System.out.println("22222");
    }

//    spel : spring expression language  ${容器 内存里面的变量 }

    @Value("${my.demo.no}")
    int no;
    @Value("${my.demo.name}")
    String name;
    @Value("${my.demo.address}")
    String address;

    @PostConstruct
    public void abc(){
        System.out.println("你看我走不");
    }

    public int getNo() {
        return no;
    }

    public void setNo(int no) {
        this.no = no;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getAddress() {
        return address;
    }

    public void setAddress(String address) {
        this.address = address;
    }
}
